﻿using A.M.ETO;
using L.M.System.Application.IServices;
using L.M.System.Application.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;

namespace L.M.System.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Role_permission_tableReadController : ControllerBase
    {
        private readonly IRole_permission_tableServices role_Permission_TableServices;
        public Role_permission_tableReadController(IRole_permission_tableServices role_Permission_TableServices)
        {
            this.role_Permission_TableServices = role_Permission_TableServices;
        }

        /// <summary>
        /// 反填该角色下的一级权限
        /// </summary>
        /// <param name="rId">角色编号</param>
        /// <returns>反填该角色下的一级权限</returns>
        [HttpGet]
        public async Task<IActionResult> GetRome_OneInfor(string? rId)
        {
            return Ok(await role_Permission_TableServices.GetRome_OneInfor(rId));
        }

        /// <summary>
        /// 反填第二级权限
        /// </summary>
        /// <param name="rId">角色编号</param>
        /// <returns>反填第二级权限</returns>
        [HttpGet]
        public async Task<IActionResult> GetRole_TwoInfor(string? rId)
        {
            return Ok(await role_Permission_TableServices.GetRole_TwoInfor(rId));
        }
    }
}
